Repository navigation
Conversation
…with a trailing slash with ENOTDIR on Windows FreeBSD 11.4 lookup answers ENOTDIR when a name with a trailing slash is not a directory (sys/kern/vfs_cache.c:2104-2105). On Windows the guest path of a mount alias lost the trailing slash, and these calls failed with ENOENT or EINVAL. The resolver now keeps the slash on Windows too, and sceKernelUnlink/unlink, remove, rename and sceKernelOpen/open answer ENOTDIR. The trailing-slash checks in guest_filesystem, which only built off Windows, run there. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
MarcZX10
left a comment
There was a problem hiding this comment.
One related trailing-slash case appears to fall through: with file a regular file, NamesNonDirectoryWithSlash_nid_no_patch("file/child/") strips the final slash to file/child, where std::filesystem::status reports not-found plus an error. exists(status) is false, so the helper returns false even though an earlier component is a regular file; the Windows operation may then map that to ENOENT instead of ENOTDIR. HasNonDirectoryPrefix_nid_no_patch(native) already walks existing parent components and looks suitable as the fallback when the named path itself is not found. Could you add a nested case (at least open and one removal path) and use that fallback?
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
file/child/ strips to file/child, which does not exist; unlink, remove, open and sceKernelUnlink still answer ENOTDIR through the non-directory prefix check. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Thanks for the review. I checked the nested case AI-assisted (Claude Code). |
What
A name that ends in
/must be a directory. FreeBSD 11.4 fails the lookup withENOTDIRotherwise (vfs_cache_lookup, sys/kern/vfs_cache.c:2104-2105). On WindowsResolveAliasdropped the slash for paths under a mount alias (it kept it only off Windows, #4681), andunlink/sceKernelUnlink,remove,renameandopen/sceKernelOpennever asked whether a name with a slash is a non-directory, so they failed withENOENT,EINVALorEIO.ResolveAliasnow keeps the slash on every host, and a shared helper (NamesNonDirectoryWithSlash_nid_no_patch) makes the four calls answerENOTDIR(the source, and an existing source's destination, inrename). The trailing-slash block ofguest_filesystem, which was compiled only off Windows, now runs on Windows.Fixes #8679
Scope note: this changes the guest path resolver (
General.cpp,ResolveAlias) and the kernel-style lookup ofunlink,remove,renameandopen, not the stdio/printf formatting that the console implements with Dinkumware;removeandrenamefollow the kernel lookup like the merged #8200 and #8199.git merge-treeagainstupstream/main, #8626, #8522, #8603, #8663, #8312 and #5528 is clean;pr_overlapwas not run.Tested
Windows 10 (19045), MinGW-w64 GCC 15.2.0, Release,
-j4, on upstream/main 2674007 + this commit:guest_filesystem: fails at the first trailing-slash check (guest errno 2) with the code taken back to main and the block enabled, passes with the change (3 of 3 runs).unlink,remove,renameoropen(65 test targets, 87 ctest entries): 85 pass, 2 were not run (guest_memory_pool_stats,guest_fstatvfs_conversion; their executables were not built, unrelated).python tools/check_conventions.py --base upstream/main: passes.lstat,access,chmod,truncate,utimes,readlink,fopenandopendirstill answer ENOENT or EINVAL forfile/on Windows; they are left for follow-ups. Earlier attempts: fix(libkernel): fail unlink of a file named with a trailing slash on Windows #5165, fix(libkernel): fail open of a file named with a trailing slash on Windows #5266 (closed).Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryAI-assisted (Claude Code).
🤖 Generated with Claude Code